<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
// Route::post('login', 'Auth\LoginController@login');
// Route::post('logout', 'Auth\LoginController@logout')->name('logout');

Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
Route::post('register', 'Auth\RegisterController@register');

Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset');


Route::group(['namespace'=>'Home'],function(){
    // 登录
    Route::post('login','LoginController@store')->name('login');
    // 登出
    Route::post('logout','LoginController@destroy')->name('logout');
	//产品列表
	Route::get('products','ProductController@index')->name('products');
	//添加产品
	Route::post('products','ProductController@store')->name('users.products.store');
	//删除产品
	Route::delete('products/{product}','ProductController@destroy')->name('products.destroy');

	Route::get('products/{product}/options','OptionController@index')->name('products.options.index');
	// 期货表格数据
	Route::any('products/{product}/jsonExport','OptionController@jsonExport');
	// 期权表格数据
	Route::any('products/{product}/jsonTable','OptionController@jsonTable');
	// 折线图数据
	Route::any('products/{product}/jsonPaint','OptionController@jsonPaint');

	// 添加期权
	Route::post('options','OptionController@store');
	// 编辑期权
	Route::patch('options','OptionController@update');
	// 删除期权
	Route::delete('options/{id}','OptionController@destroy');
});
